<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>门店打印机设置</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
	</head>

	<body>
		<form class="layui-form update_form" action="">
			<input type="hidden" name="id"  value="{$ad.id}"/>
			<input type="hidden" name="mid"  value="{$mid}"/>
			<div class="layui-form-item">
				<label class="layui-form-label">打印机终端号</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="machine_code"  value="{$ad.machine_code}" required lay-verify="required" placeholder="打印机终端号" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">打印机密钥</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="msign" value="{$ad.msign}" required lay-verify="required" placeholder="打印机密钥" autocomplete="off" class="layui-input">
				</div>
			</div>
			<!--<div class="layui-form-item">
				<label class="layui-form-label">用户ID</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="partner" value="{$ad.partner}" required lay-verify="required" placeholder="用户ID" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">API密钥</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="apiKey" value="{$ad.apiKey}" required lay-verify="required" placeholder="API密钥" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">平台用户名</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="ptname" value="{$ad.ptname}" required lay-verify="required" placeholder="平台用户名" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">平台密码</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="password" value="{$ad.password}" required lay-verify="required" placeholder="平台密码" autocomplete="off" class="layui-input">
				</div>
			</div>-->
			<div class="layui-form-item update_btnbox">
				<div class="layui-input-block">
					<button class="layui-btn"  lay-submit lay-filter="submit_from" type="button">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
			<label style="padding-left: 20%;">帮助：<a href="https://www.10ss.net/" target="_blank" style="color: red;">请参考易联云官方</a>
				<a href="https://detail.youzan.com/show/goods?alias=bdsq51kd&v2/goods/bdsq51kd" target="_blank" style="color: red;">购买链接</a>
			</label>
		</form>
<script>
//Demo
layui.use('form', function() {
	var form = layui.form;
	
	//监听表单提交
		form.on('submit(submit_from)', function(data){
			tijiao();
  			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
});
function tijiao() {
$.ajax({
	type: "post",
	url: "{:url('store/daying_edit')}",
	data: $('.layui-form').serialize(), //表单数据
	success: function(data) {
		if(data.code == 200) {
			layer.msg('成功', {
				icon: 1,
				time: 1500 //2秒关闭（如果不配置，默认是3秒）
			}, function() {
				window.parent.location.reload();
				var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
				parent.layer.close(index);
			});
		} else {
			layer.msg('失败！'); //保存成功提示
			}
		},
		error: function(data) {
			var a = data;
		}
	});

}

</script>
</body>

</html>